In [ ]:
import astropy.units as u
import astropy.coordinates as coord
from astropy.table import Table

In [ ]:
d = np.genfromtxt('/Users/adrian/projects/triand-rrlyrae/data/Catalina_all_RRLyr.txt', dtype=None, usecols=range(11), names=True)

In [ ]:
tbl = Table(d)

In [ ]:
c = coord.SkyCoord(ra=tbl['ra']*u.deg, dec=tbl['dec']*u.deg)

In [ ]:
g = c.galactic

In [ ]:
tbl['l'] = g.l.degree
tbl['b'] = g.b.degree

In [ ]:
tbl

In [ ]:
ascii.write(tbl, output="/Users/adrian/projects/triand-rrlyrae/data/catalina.csv", format='fast_csv')

Compare with old, borked version


In [ ]:
import matplotlib.pyplot as pl
from astropy.io import ascii
%matplotlib inline

In [ ]:
tbl2 = ascii.read('/Users/adrian/projects/triand-rrlyrae/data/Catalina_all_RRLyr_WRONG.txt')

In [ ]:
diffs = tbl2['Eta'] - tbl['mjd0']

In [ ]:
pl.hist(np.log10(np.abs(diffs)), bins=np.linspace(-3.5,0,32));
pl.axvline(np.log10(0.25), color='r')

In [ ]: